fix: add exact resume-safe WWPGD projection dose telemetry - #131
Open
charlesmartin14 wants to merge 5 commits into
Open
fix: add exact resume-safe WWPGD projection dose telemetry#131charlesmartin14 wants to merge 5 commits into
charlesmartin14 wants to merge 5 commits into
Conversation
Replace PR #129's ambiguous first-event flag with exact realized dose fields, zero-based scheduled-event labeling, and per-layer first actual application counts reconstructed from durable scientific projection history. Add old-schema rejection, checkpoint-reconciliation coverage, focused tests, and documentation. No optimizer or projection mathematics change.
charlesmartin14
force-pushed
the
agent/wwpgd-dose-telemetry-v2
branch
from
August 9, 2026 04:25
397066b to
fb37462
Compare
charlesmartin14
marked this pull request as ready for review
August 9, 2026 04:39
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status
Ready for review. This PR supersedes the scientific-runner intent of #129 without carrying forward its off-by-one, first-application, or long-run performance errors. All six repository CI jobs pass on the exact head.
Scope
The change applies to
wwpgd_projection.csvartifacts written by the mainrun_scientific_singledurable writer. It covers the scientific Level 0–2 WW-PGD, delayed-onset, adaptive, and norm-matched-sham arms.It deliberately does not silently redefine the separate invalid-for-science
run_singlesmoke CSV or the isolatedlevel_0_wwpgdpackage’s independent schema; those paths have different lifecycle conventions.What changed
Every main scientific-runner row written to
wwpgd_projection.csvnow includes:dose_definition = applied_projection_delta_frobenius_over_preprojection_weight_frobeniusdose_value, equal to the existing realizedrelative_frobenius_change_applieddose_relative_frobenius, a compatibility alias ofdose_valuedose_applied, true only when the live matrix actually changed and the realized dose is positivelayer_application_index, a one-based count of actual applications for that layeris_first_applied_projection = (layer_application_index == 1)projection_event_index_base = 0projection_event_number = projection_event + 1is_first_scheduled_projection_event = (projection_event == 0)The realized dose is
Why this differs from #129
PR #129 marked
event_index == 1as the first projection event, but the main scientific training extension uses zero-based event indexes. More importantly, a scheduled event is not necessarily an actual application: warm-up, delayed onset, adaptive gates, zero hardness, unchanged candidates, and trust-region behavior can delay or suppress a layer update.This PR therefore separates two facts:
Actual applications are counted independently per layer from the durable projection history. Checkpoint recovery reconciles the CSV to its committed prefix before new writes, making
is_first_applied_projectioncorrect after resume or process restart without adding mutable counters to the optimizer, controller, model, or checkpoint state.Efficient durable index
A small hidden sidecar caches only the current per-layer application counts plus the projection CSV byte size and nanosecond modification time. Normal interval-one experiments therefore do not rescan the complete CSV after every optimizer step.
The CSV remains authoritative. If the sidecar is absent, malformed, stale, or no longer matches a reconciled/truncated CSV, the cache is discarded and rebuilt from the durable CSV before the next append.
Implementation boundary
The enrichment occurs in the shared durable CSV writer only when the target file is exactly
wwpgd_projection.csv. Other scientific CSV artifacts are unchanged, and caller row dictionaries are copied rather than mutated.The writer fails loudly for malformed projection telemetry, including:
is_first_projection_eventfield;Compatibility
This extends the main scientific projection CSV header. Existing incomplete scientific runs with the old header are rejected before append and should be restarted under the new schema. No model weights, optimizer state, projection mathematics, target alpha, hardness, trust-region control, or defaults change.
Validation
Focused tests cover:
All six repository CI jobs pass on the exact head:
No scientific efficacy claim is made.